package com.hik.springboot_mybatis.mapper;


import com.hik.springboot_mybatis.bean.Gap;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author: wukangrong
 * @date: 2021/2/21 9:49
 * @description:
 */
@Mapper
public interface IGap {


    @Select("select *  from gap")
    List<Gap> selectAll();

    /**
     * 分表查询
     * _${tableName}
     */
    @Select("select * from gap where comefrom = #{comefrom}")
    @Results(id = "gapMap", value = {
            @Result(id = true, column = "gap_id", property = "gapId"),
            @Result(column = "alarm_name", property = "alarmName"),
            @Result(column = "comefrom", property = "comefrom")
    })
    Gap selectCustom(/*@Param("tableName") String tableNmme,*/Gap gap);


    @Select("select * from ${dbName}.gap_${tableName}")
    @ResultMap("gapMap")
    Gap selectCustom2(@Param("dbName") String dbName, @Param("tableName") String tableNmme);


    @Select("select * from gap where comefrom = #{comefrom}")
    @ResultMap("gapMap")
    List<Gap> selectCustom3(@Param("comefrom") int comefrom);


    List<Gap> selectAll2();
}
